#ifndef UnstructMG_CHEBYSHEV_HPP
#define UnstructMG_CHEBYSHEV_HPP

#include "iter_solver.hpp"

template<typename idx_t, typename pc_data_t, typename pc_calc_t, typename ksp_t, int dof>
class ChebyshevSolver : public IterativeSolver<idx_t, pc_data_t, pc_calc_t, ksp_t, dof> {
public:
    ChebyshevSolver();
    void SetCheckStep(int step);
    void SetRatio(double ratio);
    void SetMaxEigenValue(double max_eig);
protected:
    int ck_step = 10;
    double lambda = 1.0;// 最大特征值
    double eig_ratio = 1.0;// 最小最大特征值之比
    // void SetOperator(const Operator<idx_t, ksp_t, dof> & op);
    void Mult_ipl(const par_Vector<idx_t, ksp_t, dof> & b, par_Vector<idx_t, ksp_t, dof> & x) const ;
};

typedef ChebyshevSolver<int, double, double, double, 1> ChebyshevSolver_I32All64_DOF1;
typedef ChebyshevSolver<int, double, double, double, 2> ChebyshevSolver_I32All64_DOF2;
typedef ChebyshevSolver<int, double, double, double, 3> ChebyshevSolver_I32All64_DOF3;
typedef ChebyshevSolver<int, double, double, double, 4> ChebyshevSolver_I32All64_DOF4;

typedef ChebyshevSolver<int, float , double, double, 1> ChebyshevSolver_I32K64P64D32_DOF1;
typedef ChebyshevSolver<int, float , double, double, 2> ChebyshevSolver_I32K64P64D32_DOF2;
typedef ChebyshevSolver<int, float , double, double, 3> ChebyshevSolver_I32K64P64D32_DOF3;
typedef ChebyshevSolver<int, float , double, double, 4> ChebyshevSolver_I32K64P64D32_DOF4;

typedef ChebyshevSolver<int, float , float , double, 1> ChebyshevSolver_I32K64P32D32_DOF1;
typedef ChebyshevSolver<int, float , float , double, 2> ChebyshevSolver_I32K64P32D32_DOF2;
typedef ChebyshevSolver<int, float , float , double, 3> ChebyshevSolver_I32K64P32D32_DOF3;
typedef ChebyshevSolver<int, float , float , double, 4> ChebyshevSolver_I32K64P32D32_DOF4;

typedef ChebyshevSolver<int, float , float , float , 1> ChebyshevSolver_I32All32_DOF1;
typedef ChebyshevSolver<int, float , float , float , 2> ChebyshevSolver_I32All32_DOF2;
typedef ChebyshevSolver<int, float , float , float , 3> ChebyshevSolver_I32All32_DOF3;
typedef ChebyshevSolver<int, float , float , float , 4> ChebyshevSolver_I32All32_DOF4;
#ifdef USE_FP16
typedef ChebyshevSolver<int, __fp16, float , double, 1> ChebyshevSolver_I32K64P32D16_DOF1;
typedef ChebyshevSolver<int, __fp16, float , double, 2> ChebyshevSolver_I32K64P32D16_DOF2;
typedef ChebyshevSolver<int, __fp16, float , double, 3> ChebyshevSolver_I32K64P32D16_DOF3;
typedef ChebyshevSolver<int, __fp16, float , double, 4> ChebyshevSolver_I32K64P32D16_DOF4;

typedef ChebyshevSolver<int, __fp16, float , float , 1> ChebyshevSolver_I32K32P32D16_DOF1;
typedef ChebyshevSolver<int, __fp16, float , float , 2> ChebyshevSolver_I32K32P32D16_DOF2;
typedef ChebyshevSolver<int, __fp16, float , float , 3> ChebyshevSolver_I32K32P32D16_DOF3;
typedef ChebyshevSolver<int, __fp16, float , float , 4> ChebyshevSolver_I32K32P32D16_DOF4;
#endif

#endif